const express = require('express');
const query = require('../conn/conn.js');
const router = express.Router();


router.get('/getItems', async(req, res, next) => {
    let result = await query('select * from product');
    res.send(result);
});

router.get('/getItems', async(req, res, next) => {
    let result = await query('select * from product');
    res.send(result);

});

router.get('/getItem', async(req, res, next) => {
    let id = req.query['product_id'];
    let result = await query(`select * from product where id=${id}`);
    res.send(result);
});


module.exports = router;